Skip to content

fix: remove tools from condensation metadata to fix 500 errors on proxies#11770

Draft
roomote[bot] wants to merge 1 commit intomainfrom
fix/condense-context-remove-tools-metadata
Draft

fix: remove tools from condensation metadata to fix 500 errors on proxies#11770
roomote[bot] wants to merge 1 commit intomainfrom
fix/condense-context-remove-tools-metadata

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Feb 26, 2026

Related GitHub Issue

Closes: #11743

Description

This PR attempts to address Issue #11743 where context condensation fails with a 500 Internal Server Error when using the Roo Code Router.

Root cause: The condensation flow in src/core/condense/index.ts already converts all tool_use and tool_result blocks to plain text, and the SUMMARY_PROMPT explicitly instructs the model not to call tools. However, the three call sites in Task.ts that trigger condensation were building and passing tool definitions (tools, tool_choice: "auto", parallelToolCalls: true) in the metadata. This inconsistent combination -- tool definitions present but no tool blocks in messages -- causes 500 errors on proxies like the Roo Code Router.

Fix: Remove tools, tool_choice, and parallelToolCalls from the condensation metadata in all three places in Task.ts:

  1. condenseContext() (manual condensation)
  2. handleContextWindowExceededError() (context window exceeded)
  3. recursivelyMakeClineRequests() (automatic context management)

The metadata now only includes mode and taskId, which is consistent with the existing design intent.

Feedback and guidance are welcome.

Test Procedure

  • Added a new test in Task.spec.ts verifying that condenseContext() does NOT pass tools, tool_choice, or parallelToolCalls to summarizeConversation
  • All existing Task tests pass (39 passed, 4 skipped)
  • All condense tests pass (122 passed)
  • Lint and type checks pass across the entire monorepo

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes.
  • Documentation Impact: No documentation updates required.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.

Additional Notes

The buildNativeToolsArrayWithRestrictions import in Task.ts is retained because it is still used for normal API calls (line ~4230).

Interactively review PR in Roo Code Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Condense context fails when using Roo Code Router

1 participant